<?php if (!defined('THINK_PATH')) exit();?><style>
    .add_label{
        margin-left: 10px;
    }
    .uploadpic {
        float: left;
        width: 295px;
        text-align: center;
        height: 165px;
    }

    .uploadpic h3 {
        text-align: left;
        border: 1px solid #95B8E7;
        float: left;
        padding: 4px;
        background-color: #95B8E7;
        color: #FFF;
    }

    .up-content {
        border: 1px solid #95B8E7;
        padding: 4px;
    }

    .w10 {
        float: left;
        width: 10px;
        color: #FFF;
    }

    .items {
        padding: 10px 0 4px 0;
        border-top: solid 1px #D6D4D4;
        display: block;
    }

    #dd div {
        padding-right: 10px;
        padding-bottom: 10px;
    }

    .addItems {
        float: left;
    }

    /*表格样式  */
    .add_table {
        width: 100%;
        border: 1px solid #0e90d2;
    }

    .add_table th {
        width: 80px;
        background-color: #E0ECFF;
        padding: 8px 0 8px 0;
        border-right: solid 1px #95B8E7;
        border-bottom: solid 1px #95B8E7;
    }

    .add_table td {
        border-bottom: solid 1px #95B8E7;
    }

    .add_table tr {
        border: solid 1px #95B8E7;
    }

    .tb_head {
        text-align: center;
        padding: 10px;
        background-color: #E0ECFF;
        font-size: 20px;
        font-weight: bold;
    }

    .inline {
        display: inline;
        padding-right: 5px;
    }

    .row_container {
        padding: 8px 5px 5px 5px;
    }


    .add_degx_title{
        font-size: 20px;
        color: #0e2d5f;
        text-align: center;
        padding: 10px;
        font-weight: bold;
    }
</style>
<div id="ly_degx_add" class="easyui-layout"  data-options="fit:true,border:false">
    <div data-options="region:'center',title:''" style="padding:5px;background:#eee;">

        <div class="add_degx_title">添加定额工时工序</div>
        <form id="add_degx_form" action="/degs/index.php/Home/Degx/add" enctype="multipart/form-data" method="post" style="padding:10px;">
            <table class="add_table">
                <tr>
                    <th>生产信息</th>
                    <td>
                        <div class="row_container" style="background: #FFFEE6;">
                            <div class="inline">
                                <span class="add_label">车间：</span>
                                <input id="cj_add_degx" name="cj" class="easyui-textbox"
                                       data-options="iconCls:'',editable:true,required:false,panelHeight:'auto'"
                                       style="width:100px"/>
                            </div>
                            <div class="inline">
                                <span class="add_label">工位：</span>
                                <input id="gw_add_degx" class="easyui-combogrid" data-options="editable:false,required:false"
                                       name="gw" style="width:200px;"/>
                            </div>
                            <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
                               onclick="pipei()">匹配</a>
                        </div>
                    </td>

                </tr>
                <th>车型分类</th>
                <td style="background-color:rgba(204, 204, 204, 0.4);">
                    <div class="row_container">

                        <div class="panel" style="display: block;">
                            <div class="easyui-panel panel-body panel-body-noheader" style="padding: 5px; width: 100%;"
                                 title="">
                                <span class="add_label">平台：</span>
                                <input class="easyui-combobox" name="pt" id="add_degx_pt"
                                       data-options="editable:false,panelHeight:'auto',required:true,multiple:'true'"
                                       style="width:400px;" >

                                <span class="add_label">车型分类：</span>
                                <input class="easyui-combobox" name="cl" id="add_degx_cl"
                                       data-options="editable:false,panelHeight:'auto',required:true,multiple:'true'"
                                       style="width:400px;">
                                <br><br>
                                <span class="add_label">驱动：</span>
                                <input class="easyui-combobox" name="qd" id="add_degx_qd"
                                       data-options="editable:false,panelHeight:'auto',required:true,multiple:'true'"
                                       style="width:400px;">

                                <span class="add_label">燃料型式：</span>
                                <input class="easyui-combobox" name="rl" id="add_degx_rl"
                                       data-options="editable:false,panelHeight:'auto',required:true,multiple:'true'"
                                       style="width:400px;">
                                <br>
                                <br>
                                <span class="add_label">其他：</span>
                                <input id="" name="qtfl" class="easyui-textbox"
                                       data-options="iconCls:'',editable:true,required:false" style="width:400px"/>
                                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
                                   onclick="pipei()">匹配</a>
                            </div>
                        </div>
                    </div>
                </td>
                </tr>

                <tr>
                    <th>工序名称</th>
                    <td>
                        <input name="title" class="easyui-textbox" id="content" style="width: 100%; "
                               data-options="required:true,prompt:'请输入简短的工序名称'"/>
                        <br/>
                    </td>
                </tr>
                <tr>
                    <th>工序描述</th>
                    <td>
                    <textarea name="sm" class="easyui-textbox" id="discr" style="width: 100%; height: 46px;"
                              data-options="required:true"></textarea>
                        <br/>
                    </td>
                </tr>
                <tr>
                    <th>上传图片</th>
                    <td>
                        <div class="easyui-panel" style="padding:5px;">
                            <input  name="pics[]" id="add_degx_pics"  style="width:80%;"  data-options="multiple:true,buttonText:'上传图片',buttonIcon:'icon-standard-bullet-picture',buttonAlign:'right',accept:'image/*'"
                                    class="easyui-filebox">
                        </div>
                    </td>
                </tr>
                <tr>
                    <th>工艺文件</th>
                    <td>
                        <div class="easyui-panel" style="padding:5px;">
                            <input  name="file[]" id="add_degx_file"  style="width:80%;"  data-options="multiple:true,buttonText:'上传工艺文件',buttonIcon:'icon-standard-bullet-picture',buttonAlign:'right',accept:'application/pdf,application/msword'"
                                    class="easyui-filebox">
                        </div>
                    </td>
                </tr>
                <tr>
                    <th>备注</th>
                    <td>

                    <textarea name="bz" class="easyui-textbox" id="beizhu" style="width: 100%; height: 46px;" onkeyup=""
                              data-options=""></textarea>
                        <br/>
                    </td>
                </tr>
            </table>
            <input type="hidden" name="status" id="status" value="待处理">
            <input type="hidden" name="userid" id="userid" value=<?php echo ($_SESSION['uid']); ?>>
            <input type="hidden" name="author" id="author" value=<?php echo ($_SESSION['uname']); ?>>
            <input type="hidden" name="nickname" id="nickname" value=<?php echo ($_SESSION['unickname']); ?>>
        </form>
    </div>

    <div data-options="region:'east',iconCls:'icon-reload',title:'East',split:true,collapsed:true" style="width:500px;"></div>
</div>



<div style="background-color: #E0ECFF;
    bottom: 0px;
    position: absolute;
    width: 100%;
    border: 1px solid #95b8e7;">
    <a href="#" class="easyui-linkbutton" onclick='newDegx()'
       data-options="iconCls:'icon-standard-page-word',plain:true">新建定额工序</a>
    <a href="#"  class="easyui-linkbutton" onclick='clearDegxForm()'
       data-options="iconCls:'icon-standard-coins-delete',plain:true">清空</a>
    <a href="#"  class="easyui-linkbutton" onclick='back_degx_add()'
       data-options="iconCls:'icon-standard-cup-go',plain:true">返回</a>
</div>
<script>


    $("#add_degx_pt").combobox({
        url:'/degs/index.php/Home/Degx/cxfl',
        valueField:'value',
        textField:'title',
        queryParams: {
            "fl" : 'pt'
        }
    });
    $("#add_degx_cl").combobox({
        url:'/degs/index.php/Home/Degx/cxfl',
        valueField:'value',
        textField:'title',
        queryParams: {
            "fl" : 'cl'
        }
    });
    $("#add_degx_qd").combobox({
        url:'/degs/index.php/Home/Degx/cxfl',
        valueField:'value',
        textField:'title',
        queryParams: {
            "fl" : 'qd'
        }
    });
    $("#add_degx_rl").combobox({
        url:'/degs/index.php/Home/Degx/cxfl',
        valueField:'value',
        textField:'title',
        queryParams: {
            "fl" : 'rl'
        }
    });

$('#lb').combobox({
        onSelect: function(param){
            console.log(param)

            var n=param.value-1;
            var str=['工作自检、互检与专检相结合以确保正确无误,自检七步法，互检三步法，专检五步法。','对缺少标识，未经检验及不合格的零部件不得装配使用，装配前应主动检查零部件的正确性和外观质量，发现不合格产品及零部件不应装配，应及时向质量人员报告。','1.装配工在装配之前，应首先熟悉本工位的工艺文件、图纸及技术要求；并在装配工作中，严格执行工艺及产品图纸等技术要求。2.装配完毕后，装配工应自检所装配的内容是否符合工艺要求，保证质量，最后应及时在整车装配检验跟单上签名。3.装配中所使用的各种工具、夹具、量具应符合工艺要求、且具备合格标准及完整性。4.各零部件及分总成，在装配中应保持清洁干净，不应直接接触地面，装配场地应清洁整齐，做到文明生产。5.装配工作中作业人员不得擅自更改装配挂单等工艺文件，防止错装、漏装；工作自检、互检与专检相结合以确保正确无误。','设计文件未及时转化'];
            $('#gy').textbox('setText',str[n]);
            console.log(str[n])

            // str[param.value]
        }
    });


    function back_degx_add(){
        var tab = $('#tab').tabs('getSelected');
        tab.panel('refresh', APP+'/Home/Degx/index');
    }
    function newDegx(){
        $('#add_degx_form').form('submit', {

            url :APP+ '/Home/Degx/add',
            onSubmit: function(param){
                // param.gy = $('#gy').textbox('getText');
            },

            success : function(data) {
                $('#add_degx_form').form('clear');
                $.messager.confirm('确认',data+'是否要返回列表页面',function(r){
                    if (r){
                        var tab = $('#tab').tabs('getSelected');
                        tab.panel('refresh', APP+'/Home/Degx/index');
                    }
                });
            }
        });
    }
    function clearDegxForm(){
        $.messager.confirm('确认','您确认想要清空记录吗？',function(r){
            if (r){
                $('#add_degx_form').form('clear');
            }
        });
    }

    $('#cj_add_degx').combobox({
        valueField: 'id',
        url: APP+'/Admin/Trem/cjList',
        textField: 'title',
        editable: false,
        onSelect: function (rec) {
            $('#gw_add_degx').combogrid({
                panelWidth: 200,
                idField: 'title',
                textField: 'title',
                multiple: true,
                striped: true,
                url: APP+'/Admin/Trem/cjList?pid=' + rec.id,
                columns: [[
                    {field: 'title', title: '名称', width: 120}
                ]]
            });
            $('#gw_add_degx').combobox('clear');
        }
    });


    // 匹配MES信息
    function pipei() {

        // 匹配之前西安清空
        $('#lshqj').textbox('clear');
        $('#jsh').textbox('clear');
        $('#cx').textbox('clear');

        // $('#fkbm').textbox('clear');
        var lsh = $('#lshpp').textbox('getText');
        if (lsh != "") {
            $.post("/degs/index.php/Home/Zhiliang/pipei", {lsh: lsh}, function (result) {
                // $("span").html(result);
                console.log(result);
                if (result.status == '1') {
                    $('#lshqj').textbox('setValue', result.data.lshqj);
                    $('#jsh').textbox('setValue', result.data.sjjhh);
                    $('#cx').textbox('setValue', result.data.cl);

                } else {
                    $.messager.alert('匹配车型信息', result.data, 'info');
                }

            }, "json");
        } else {
            $.messager.alert('匹配车型信息', '请输入流水号', 'info');
        }
    }


</script>